home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr46 / vfwdk.zip / VFWSDK.ZIP / SAMPLES / WRITEAVI / AVIEASY.H < prev    next >
C/C++ Source or Header  |  1993-02-04  |  4KB  |  135 lines

  1. /****************************************************************************
  2.  *
  3.  *  AVIEASY.H
  4.  *
  5.  *  basic routines for writing Standard AVI files
  6.  *
  7.  *  Copyright (c) 1992-1993 Microsoft Corporation.  All Rights Reserved.
  8.  *
  9.  *  You have a royalty-free right to use, modify, reproduce and
  10.  *  distribute the Sample Files (and/or any modified version) in
  11.  *  any way you find useful, provided that you agree that
  12.  *  Microsoft has no warranty obligations or liability for any
  13.  *  Sample Application Files which are modified.
  14.  *
  15.  ***************************************************************************/
  16.  
  17. //
  18. // if you dont include avi_fmt.h we will define what we need.
  19. //
  20. #ifndef _INC_AVIFMT
  21.  
  22. #ifndef mmioFOURCC
  23.     #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
  24.         ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) |    \
  25.         ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
  26. #endif
  27.  
  28. #define streamtypeVIDEO         mmioFOURCC('v', 'i', 'd', 's')
  29. #define streamtypeAUDIO         mmioFOURCC('a', 'u', 'd', 's')
  30. #define streamtypeMIDI          mmioFOURCC('m', 'i', 'd', 's')
  31. #define streamtypeTEXT          mmioFOURCC('t', 'x', 't', 's')
  32.  
  33. /* Flags for index */
  34. #define AVIIF_KEYFRAME      0x00000010L // this frame is a key frame.
  35.  
  36. /* This is the structure of the main AVI header found in the "avih" chunk */
  37. /* of the "hdrl" list of the RIFF file.                                   */
  38. typedef struct 
  39. {
  40.     DWORD        dwMicroSecPerFrame;    // frame display rate (or 0L)
  41.     DWORD        dwMaxBytesPerSec;    // max. transfer rate
  42.     DWORD        dwPaddingGranularity;    // pad to multiples of this
  43.                                                 // size; normally 2K.
  44.     DWORD        dwFlags;        // the ever-present flags
  45.     DWORD        dwTotalFrames;        // # frames in file
  46.     DWORD        dwInitialFrames;
  47.     DWORD        dwStreams;
  48.     DWORD        dwSuggestedBufferSize;
  49.     
  50.     DWORD        dwWidth;
  51.     DWORD        dwHeight;
  52.     
  53.     DWORD        dwReserved[4];
  54. } MainAVIHeader;
  55.  
  56. /* This is the structure of each stream header found in the "strh" chunk */
  57. /* of the "strl" list of the "hdrl" list of the RIFF file.               */
  58. typedef struct {
  59.     DWORD               fccType;
  60.     DWORD               fccHandler;
  61.     DWORD               dwFlags;        /* Contains AVITF_* flags */
  62.     DWORD               dwPriority;
  63.     DWORD               dwInitialFrames;
  64.     DWORD               dwScale;        
  65.     DWORD               dwRate; /* dwRate / dwScale == samples/second */
  66.     DWORD               dwStart;
  67.     DWORD               dwLength; /* In units above... */
  68.     DWORD               dwSuggestedBufferSize;
  69.     DWORD               dwQuality;
  70.     DWORD               dwSampleSize;
  71.     RECT                rcFrame;
  72. } AVIStreamHeader;
  73.  
  74. #endif
  75.  
  76. #ifndef AVIERR_OK
  77. #define AVIERR_OK                0L
  78. #define AVIERR_UNSUPPORTED      -1L
  79. #define AVIERR_BADFORMAT        -2L
  80. #define AVIERR_MEMORY           -3L
  81. #define AVIERR_INTERNAL         -4L
  82. #define AVIERR_BADFLAGS         -5L
  83. #define AVIERR_BADPARAM         -6L
  84. #define AVIERR_BADSIZE          -7L
  85. #define AVIERR_BADHANDLE        -8L
  86. #define AVIERR_FILEREAD         -9L
  87. #define AVIERR_FILEWRITE        -10L
  88. #define AVIERR_FILEOPEN         -11L
  89. #define AVIERR_COMPRESSOR       -12L
  90. #define AVIERR_NOCOMPRESSOR     -13L
  91. #define AVIERR_USERABORT        -99L
  92. #define AVIERR_ERROR            -100L
  93. #endif
  94.  
  95. DECLARE_HANDLE32(HAVI);
  96.  
  97. /* These are the function prototypes of the functions provided by AVIEASY.C  */
  98.  
  99. LONG FAR avifileOpen(HAVI FAR *lphfile, LPSTR lpFileName, MainAVIHeader FAR *lphdr);
  100.  
  101. LONG FAR avifileAddStream(HAVI hfile, int FAR *lpstream,
  102.          AVIStreamHeader FAR *lphdr,
  103.          LPVOID lpFormat,
  104.          LONG   cbFormat);
  105.  
  106. // !!! This function is not implemented
  107. LONG FAR avifileWriteToHeader(HAVI hfile,
  108.               int stream,
  109.               DWORD ckid,
  110.               LPVOID lpData,
  111.               LONG cbData);
  112.  
  113. LONG FAR avifileWrite(HAVI    hfile,
  114.               int    stream,
  115.               LPVOID    lpData,
  116.               LONG    cbData,
  117.               WORD    cktype,
  118.               DWORD    dwFlags);
  119.  
  120. LONG FAR avifileEndRecord(HAVI hfile);
  121.  
  122. LONG FAR avifileClose(HAVI hfile);
  123.  
  124.  
  125. LONG FAR aviVideoOpen(HAVI FAR *lphfile,
  126.               LPSTR lpFileName,
  127.               LPBITMAPINFOHEADER lpbi,
  128.               DWORD dwMicroSecPerFrame);
  129.  
  130. LONG FAR aviVideoWriteFrame(HAVI hfile,
  131.                 LPBITMAPINFOHEADER lpbi,
  132.                 LPVOID lp,
  133.                 DWORD dwFlags);
  134.  
  135.